<template>
	<view class="">
		<write-off :list.sync="list" :isloading="isloading" :ismore="ismore"></write-off>
	</view>
</template>

<script>
	import writeOff from "./components/write-off.vue"
	export default {
		components: {
			writeOff
		},
		data() {
			return {
				status: '',
				isloading: false,
				ismore: true,
				page: 0,
				list: [],
			}
		},
		onLoad(options) {
			this.status = options.status;
			switch (String(this.status)) {
				case '-1':
					uni.setNavigationBarTitle({
						title: '团购已退款'
					})
					break;
				case '1':
					uni.setNavigationBarTitle({
						title: '团购待核销'
					})
					break;
				case '3':
					uni.setNavigationBarTitle({
						title: '团购已核销'
					})
					break;
			}
			this.getZorderList();
		},
		onReachBottom() {
			this.getZorderList();
		},
		methods: {
			getZorderList() {
				this.page++;
				this.isloading = true;
				this.ismore = true;
				this.$axios('order/zorder', "POST", 'supplier', {
					status: this.status,
					page: this.page
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						this.list = [...this.list, ...res.data.data.list];
						this.ismore = res.data.data.list.length > 0;
					}
				})
			},
		}
	}
</script>

<style lang="scss">
</style>